﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGiSectionGeometryManager : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGiSectionGeometryManager(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdGiSectionGeometryManager_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGiSectionGeometryManager obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGiSectionGeometryManager()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGiSectionGeometryManager(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdGiSectionGeometryManager cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_cast(OdRxObject.getCPtr(pObj));
			OdGiSectionGeometryManager result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSectionGeometryManager_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSectionGeometryManager_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdGiSectionGeometryManager_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdGiSectionGeometryManager createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_createObject();
			OdGiSectionGeometryManager result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSectionGeometryManager)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdDbStub getLiveSection(OdDbStub layoutId, OdDbStub sectionSettingsId)
		{
			IntPtr intPtr = GlobalsPINVOKE.OdGiSectionGeometryManager_getLiveSection(this.swigCPtr, OdDbStub.getCPtr(layoutId), OdDbStub.getCPtr(sectionSettingsId).Handle);
			OdDbStub result = (intPtr == IntPtr.Zero) ? null : new OdDbStub(intPtr, false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiDrawable createLiveSection(OdRxObject pDb, OdDbStub visualStyleId, OdGePoint3dArray points, OdGeVector3d verticalDir, SWIGTYPE_p_double dTop, SWIGTYPE_p_double dBottom)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_createLiveSection__SWIG_0(this.swigCPtr, OdRxObject.getCPtr(pDb), OdDbStub.getCPtr(visualStyleId), OdGePoint3dArray.getCPtr(points), OdGeVector3d.getCPtr(verticalDir), SWIGTYPE_p_double.getCPtr(dTop), SWIGTYPE_p_double.getCPtr(dBottom));
			OdGiDrawable result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiDrawable createLiveSection(OdRxObject pDb, OdDbStub visualStyleId, OdGePoint3dArray points, OdGeVector3d verticalDir, SWIGTYPE_p_double dTop)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_createLiveSection__SWIG_1(this.swigCPtr, OdRxObject.getCPtr(pDb), OdDbStub.getCPtr(visualStyleId), OdGePoint3dArray.getCPtr(points), OdGeVector3d.getCPtr(verticalDir), SWIGTYPE_p_double.getCPtr(dTop));
			OdGiDrawable result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiDrawable createLiveSection(OdRxObject pDb, OdDbStub visualStyleId, OdGePoint3dArray points, OdGeVector3d verticalDir)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_createLiveSection__SWIG_2(this.swigCPtr, OdRxObject.getCPtr(pDb), OdDbStub.getCPtr(visualStyleId), OdGePoint3dArray.getCPtr(points), OdGeVector3d.getCPtr(verticalDir));
			OdGiDrawable result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiDrawable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isLiveSection(OdGiDrawable pDrawable)
		{
			bool result = GlobalsPINVOKE.OdGiSectionGeometryManager_isLiveSection(this.swigCPtr, OdGiDrawable.getCPtr(pDrawable));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool generateSectionGeometry(OdGiDrawable section, OdGiDrawable drawable, OdGeMatrix3d xform, OdGiSectionGeometry geom, bool bHasForeground)
		{
			bool result = GlobalsPINVOKE.OdGiSectionGeometryManager_generateSectionGeometry(this.swigCPtr, OdGiDrawable.getCPtr(section), OdGiDrawable.getCPtr(drawable), OdGeMatrix3d.getCPtr(xform), OdGiSectionGeometry.getCPtr(geom), bHasForeground);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdGiSectionGeometryMap createSectionGeometryMap()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdGiSectionGeometryManager_createSectionGeometryMap(this.swigCPtr);
			OdGiSectionGeometryMap result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdGiSectionGeometryMap)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdGiSectionGeometryMap)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdGiSectionGeometryMap)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual int classifyExtentsRelativelySection(OdGiDrawable pDrawable, OdGeExtents3d ext)
		{
			int result = GlobalsPINVOKE.OdGiSectionGeometryManager_classifyExtentsRelativelySection(this.swigCPtr, OdGiDrawable.getCPtr(pDrawable), OdGeExtents3d.getCPtr(ext));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
